package com.wangzhixuan.service.impl;

import java.util.List;
import java.util.Map;

import com.wangzhixuan.commons.utils.PageInfo;
import com.wangzhixuan.model.CusGroupImage;
import com.wangzhixuan.model.vo.CArchivesImageVo;
import com.wangzhixuan.mapper.CusGroupImageMapper;
import com.wangzhixuan.service.ICusGroupImageService;
import com.baomidou.mybatisplus.plugins.Page;

import org.springframework.beans.factory.annotation.Autowired;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;

import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhixuan.wang
 * @since 2017-09-29
 */
@Service
public class CusGroupImageServiceImpl extends ServiceImpl<CusGroupImageMapper, CusGroupImage> implements ICusGroupImageService {
	
	@Autowired
    private CusGroupImageMapper cusGroupImageMapper;
    
	@Override
    public void selectDataGrid(PageInfo pageInfo) {
    	Page<Map<String, Object>> page = new Page<Map<String, Object>>(pageInfo.getNowpage(), pageInfo.getSize());
        page.setOrderByField(pageInfo.getSort());
        page.setAsc(pageInfo.getOrder().equalsIgnoreCase("asc"));
        List<CusGroupImage> list = cusGroupImageMapper.selectCusGroupImagePage(page, pageInfo.getCondition());
        pageInfo.setRows(list);
        pageInfo.setTotal(page.getTotal());
    }

	@Override
	public List<String> selectUrl(Integer cusId) {
		// TODO Auto-generated method stub
		List<String> selectUrl = cusGroupImageMapper.selectUrl(cusId);
		return selectUrl;
	}

	@Override
	public List<CArchivesImageVo> selectPicture(Integer gId) {
		List<CArchivesImageVo> picture = cusGroupImageMapper.selectPicture(gId);
		return picture;
	}
}
